﻿using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataAccessLayer;

namespace BusinessLayer
{
    /// <summary>
    /// The park point.
    /// </summary>
    public class ParkPoint : BusinessEntity
    {
        /// <summary>
        /// The park point repository.
        /// </summary>
        public class ParkPointReposytory : Repository<ParkPoint>
        {
            /// <summary>
            /// Remove the point.
            /// </summary>
            public void Remove(int parkId, int index)
            {
                DAL.Operation("Remove", "ParkPoint", new Dictionary<string, object> { { "ParkId", parkId }, { "Index", index } });
            }

            /// <summary>
            /// Remove all points of the park.
            /// </summary>
            public override void Remove(int id)
            {
                DAL.Operation("Remove", "ParkPoint", new Dictionary<string, object> { { "ParkId", id } });
            }

        }

        /// <summary>
        /// The park point repository.
        /// </summary>
        public static ParkPointReposytory Repository = new ParkPointReposytory();

        /// <summary>
        /// Gets the park id.
        /// </summary>
        public int ParkId
        {
            get { return (int)this.Get("ParkId"); }
            set { this.Set("ParkId", value); }
        }


        /// <summary>
        /// Gets the index.
        /// </summary>
        public int Index
        {
            get { return (int)this.Get("Index"); }
            set { this.Set("Index", value); }
        }

        /// <summary>
        /// Gets the x coordinate.
        /// </summary>
        public double X
        {
            get { return (double)this.Get("X"); }
            set { this.Set("X", value); }
        }

        /// <summary>
        /// Gets the y coordinate.
        /// </summary>
        public double Y
        {
            get { return (double)this.Get("Y"); }
            set { this.Set("Y", value); }
        }

        /// <summary>
        /// Default constructor.
        /// Must call Initialize method before using.
        /// </summary>
        public ParkPoint()
        {
        }

        /// <summary>
        /// Save the park point.
        /// </summary>
        public override void Save()
        {
            ParkPoint.Repository.Write(this);
        }
    }
}
